<?php
session_start();
if ($_SESSION['Status'] != '1') {
    header('Location: signup.php');
}
$id = $_SESSION['name'];
include 'dbconnection.php';

$query = "SELECT * FROM users WHERE email = '$id'";
$record = mysql_query($query);

include 'dbconnectionclose.php';
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, maximum-scale=1"/>
        <meta name="description" content="Metro UI CSS"/>
        <!--        <meta name="author" content="Sergey Pimenov"/>-->
        <meta name="keywords" content="windows 8, modern style, Metro UI, style, modern, css, framework"/>

        <link href="css/modern.css" rel="stylesheet"/>
        <link href="css/modern-responsive.css" rel="stylesheet"/>
        <link href="css/site.css" rel="stylesheet" type="text/css"/>
        <link href="js/google-code-prettify/prettify.css" rel="stylesheet" type="text/css"/>

        <script type="text/javascript" src="js/assets/jquery.js"></script>
        <script type="text/javascript" src="js/assets/jquery-1.9.0.min.js"></script>
        <script type="text/javascript" src="js/assets/jquery-1.10.2.js"></script>
        <script type="text/javascript" src="js/assets/jquery.mousewheel.min.js"></script>
        <script type="text/javascript" src="js/assets/moment.js"></script>
        <script type="text/javascript" src="js/assets/moment_langs.js"></script>
<!--        <script type="text/javascript" src="js/assets/DateTimePicker.js"></script>-->
        <script type="text/javascript" src="js/assets/jquery-ui-1.10.3.custom.js"></script>
        <link href="css/ui-lightness/jquery-ui-1.10.3.custom.css" rel="stylesheet"/>


        <script type="text/javascript" src="js/modern/dropdown.js"></script>
        <script type="text/javascript" src="js/modern/accordion.js"></script>
        <script type="text/javascript" src="js/modern/buttonset.js"></script>
        <script type="text/javascript" src="js/modern/carousel.js"></script>
        <script type="text/javascript" src="js/modern/input-control.js"></script>
        <script type="text/javascript" src="js/modern/pagecontrol.js"></script>
        <script type="text/javascript" src="js/modern/rating.js"></script>
        <script type="text/javascript" src="js/modern/slider.js"></script>
        <script type="text/javascript" src="js/modern/tile-slider.js"></script>
        <script type="text/javascript" src="js/modern/tile-drag.js"></script>
        <script type="text/javascript" src="js/modern/calendar.js"></script>
        <script type="text/javascript" src="js/modern/dialog.js"></script>
        <script type="text/javascript" src="js/modern/ajax.js"></script>

        <link href='css/fullcalendar.css' rel='stylesheet' />
        <link href='css/fullcalendar.print.css' rel='stylesheet' media='print' />
        <script src='javascript/jquery-ui.custom.min.js'></script>
        <script src='javascript/fullcalendar.min.js'></script>

        <title>Study Planner</title>

        <script type = "text/javascript">          
            function navigation(page){
                if(page=='dashboard'){
                    $.ajax({
                        url:"dashboard.php",
                        success: function(reply){
                            $('#inner-main').html(reply);
                            jQuery('#todayTasks').tileBlockSlider().data().tileBlockSlider.init();
                            jQuery('#delayedTasks').tileBlockSlider().data().tileBlockSlider.init();
                            //                            jQuery('#2moroClass').tileBlockSlider().data().tileBlockSlider.init();
                            //                            jQuery('#2moroTasks').tileBlockSlider().data().tileBlockSlider.init();
                        },
                        error:function(){
                            alert("failed");
                        }
                    });		
                }
                if(page=='calendar'){
                    $.ajax({
                        url:"calendar.php",
                        success: function(reply){
                            $('#inner-main').html(reply);
                        },
                        error:function(){
                            alert("failed");
                        }
                    });
                }
                if(page=='classes'){
                    $.ajax({
                        url:"manageClass.php",
                        success: function(reply){
                            $('#inner-main').html(reply);
                        },
                        error:function(){
                            alert("failed");
                        }
                    });
                }
                if(page=='tasks'){
                    $.ajax({
                        url:"manageTask.php",
                        success: function(reply){
                            $('#inner-main').html(reply);
                            $()["Slider"]({initAll: true});
                        },
                        error:function(){
                            alert("failed");
                        }
                    });
                }
                if(page=='groups'){
                    $.ajax({
                        url:"group.php",
                        success: function(reply){
                            $('#inner-main').html(reply);
                        },
                        error:function(){
                            alert("failed");
                        }
                    });
                }
                if(page=='profile'){
                    $.ajax({
                        url:"profile.php",
                        success: function(reply){
                            $('#inner-main').html(reply);
                        },
                        error:function(){
                            alert("failed");
                        }
                    });
                }
                 if(page=='classesNew'){
                    $.ajax({
                        url:"manageClasses.php",
                        success: function(reply){
                            $('#inner-main').html(reply);
                        },
                        error:function(){
                            alert("failed");
                        }
                    });
                }
            }
			
        </script>

    </head>
    <body class="metrouicss">
        <div class="nav-bar">
            <div style="width: 940px; margin: auto;">
                <div class="nav-bar-inner padding5" style="float: left;">
                    <span class="pull-menu"></span>
                    <div class="" style="float: left;width: 700px;">
                        <a href="/"><span class="element brand">
                                <img class="place-left" src="images/logo.png" style="height: 40px;"/>
                                Study Planner
                            </span></a>
                        <div class="divider"></div>
                    </div>
                    <div class="" style="float: left; text-align: right; width: 220px"> 
                        <?php
                        $usersname = mysql_fetch_array($record);
                        $f_name = $usersname['f_name'];
                        $l_name = $usersname['l_name'];
                        $name = $f_name . " " . $l_name;
                        ?>
                        <a class="fg-color-white" href="#" onclick="navigation('profile')"><img class="" style="height: 40px;" src="images/user.png" ><?php echo $name; ?></a>
                        <a onclick="" class="fg-color-white" href="logout.php">| Logout</a>     
                    </div>
                </div>
            </div>
        </div>
        <!--------------------------------------------------------------------------------------------------------------------------------------->
        <div class="page">
            <div class="nav-bar" style="background-color: white;">
                <div class="nav-bar-inner padding15">
                    <span class="pull-menu"></span>
                    <div class="divider"></div>

                    <ul class="menu">
                        <li onclick="navigation('dashboard')"><a href="#">Dashboard</a></li>
                        <li class="divider"></li>
                        <li onclick="navigation('calendar')"><a href="#">Calendar</a></li>
                        <li class="divider"></li>
                        <li onclick="navigation('classes')"><a href="#">Manage Class</a></li>
                        <li class="divider"></li>
                        <li onclick="navigation('tasks')"><a href="#">Tasks</a></li>
                        <li class="divider"></li>
                        <li onclick="navigation('groups')"><a href="#">Groups</a></li>
                        <li class="divider"></li>
                        <li onclick="navigation('classesNew')"><a href="#">Classes New</a></li>
                        <li class="divider"></li>
                        <!--                        <li onclick="navigation('Profile')"><a href="#">Profile</a></li>-->
                    </ul>
                </div>
            </div>
        </div>
        <!------------------------------------------------------------------------------------------------------------------------------------------------------->

        <div id="inner-main" class="page">

        </div>

        <!---------------------------------------------------------------------------------------------------------------------------------------->

        <!--    <div class="page">  -->
        <div class="nav-bar">
            <div style="width: 940px; margin: auto;">
                <div class="nav-bar-inner padding5">
                    <span class="element">
                        2013, Study Planner &copy; by <a class="fg-color-white" href="mailto:">Freak eYe</a>
                    </span>
                </div>
            </div>
        </div>
        <!--  </div> -->
        <script type="text/javascript" src="js/assets/github.info.js"></script>
        <script type="text/javascript" src="js/assets/google-analytics.js"></script>
        <script type="text/javascript" src="js/google-code-prettify/prettify.js"></script>
        <script src="js/sharrre/jquery.sharrre-1.3.4.min.js"></script>
        <script>
            $('#shareme').sharrre({
                share: {
                    googlePlus: true
                    ,facebook: true
                    ,twitter: true
                    ,delicious: true
                },
                urlCurl: "js/sharrre/sharrre.php",
                buttons: {
                    googlePlus: {size: 'tall'},
                    facebook: {layout: 'box_count'},
                    twitter: {count: 'vertical'},
                    delicious: {size: 'tall'}
                },
                hover: function(api, options){
                    $(api.element).find('.buttons').show();
                }
            });
        </script>
    </body>
</html>